package com.robert.taibots;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class AboutActivity extends AppCompatActivity implements View.OnClickListener {
    private ImageButton backButton;
    private ImageButton ruleButton;
    private ImageButton privateButton;
    private AlertDialog alert = null;
    private AlertDialog.Builder builder = null;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        setContentView(R.layout.about_activity);
        backButton = (ImageButton) findViewById(R.id.backBu);
        ruleButton = (ImageButton) findViewById(R.id.ruleButton);
        privateButton = (ImageButton) findViewById(R.id.priButton);
        backButton.setOnClickListener(this);
        ruleButton.setOnClickListener(this);
        privateButton.setOnClickListener(this);
        builder = new AlertDialog.Builder(AboutActivity.this);
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.backBu) {
            Toast.makeText(this,"Back",Toast.LENGTH_LONG).show();
            finish();
        } else if (view.getId() == R.id.ruleButton) {
            Toast.makeText(this,"Game Rules",Toast.LENGTH_LONG).show();
            alert = null;
            alert = builder.setTitle(R.string.rule_title)
                    .setMessage(R.string.rule_string)
                    .setPositiveButton("我知道了", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {

                        }
                    }).create();
            alert.show();
        } else {
            Toast.makeText(this,"Privacy Agreement",Toast.LENGTH_LONG).show();
            Intent it = new Intent(AboutActivity.this, WebActivity.class);
            startActivity(it);
        }
    }
}
